<template>
	<view>
		<van-space direction="vertical" fill size="1rem">
    <div v-for="themeData in themeDataList" :key="themeData.id">
			<van-cell-group inset style="--van-cell-background: rgba(240, 249, 248, 1);">
			  <van-cell  :title= "themeData.chartName" :label = "getChild(themeData.childList)" :to="'/' +  themeData.id.replace('_','')" />
			</van-cell-group>
		</div>
    <org-select @clickChildOrg="clickEven">机构选择</org-select>
    </van-space>
	</view>
</template>

<script setup>
import {ref, reactive, onMounted} from 'vue';
import { getTheme } from '@/api/chart/index';
import { useRouter } from 'vue-router';
import OrgSelect from '@/components/common/OrgSelect.vue'

// let themeDataList = reactive([]);
/*getTheme().then((resultData)=>{

})*/
const themeDataList = ref([])
onMounted(async function (){
  /*const { resultData } = await getTheme();
  themeDataList.value = resultData;
  console.log(themeDataList);*/
});


const getThemes = async () => {
  const { resultData } = await getTheme();
  themeDataList.value = resultData;
  console.log(themeDataList);
}
getThemes();
//
function getChild (chalid){
  const arr = chalid.map( item =>{
    return item.chartName;
  })
  return arr.join('|')
}
//跳转
const router = useRouter();
/*function toLsd() {
  router.push({
    path: '/lsd01',
  })
}*/

//机构组件传值

const orgResult=ref('')
const clickEven=(val)=>{
  console.log(val);
  orgResult.value=val
}

</script>

<style>
	:root:root {
	}
</style>